package com.jzo2o.customer.controller.agency;

import com.jzo2o.customer.model.domain.BankAccount;
import com.jzo2o.customer.model.dto.request.BankAccountUpsertReqDTO;
import com.jzo2o.customer.service.IBankAccountService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 银行账户相关接口
 *
 * @author itcast
 * @create 2023/9/11 16:14
 **/
@RestController("AgencyBankAcountController")
@RequestMapping("/agency/bank-account")
@Api(tags = "服务端 - 银行账户相关接口")
public class AgencyBankAcountController {

    @Autowired
    private IBankAccountService bankAccountService;

    /**
     * 新增银行账户
     * @param reqDTO
     * @return
     */
    @PostMapping
    public Boolean addOrUpdate(@RequestBody BankAccountUpsertReqDTO reqDTO){
       return bankAccountService.add(reqDTO);
    }

    /**
     * 查询当前用户账户
     * @return
     */
    @GetMapping("/currentUserBankAccount")
    public BankAccount currentUserBankAccount(){
        BankAccount bankAccount = bankAccountService.getByUserId();
        return bankAccount;
    }
}
